<template>
  <!-- 视频学堂 -->
  <div>
    <van-nav-bar fixed title="视频学堂">
      <template #left>
        <van-icon name="arrow-left" @click="$router.go(-1)" />
      </template>
    </van-nav-bar>

    <div style="height: 46px"></div>

    <van-tabs
      offset-top="46px"
      sticky
      v-model="active"
      title-active-color="#FF7F24"
      title-inactive-color="#BEBEBE"
      color="#FF7F24"
    >
      <van-tab title="推荐">
        <!-- 轮播图 -->
        <van-swipe
          style="height: 66vw"
          class="my-swipe"
          :autoplay="2000"
          indicator-color="white"
        >
          <van-swipe-item>
            <img src="/baking1/lunbo1.jpeg" style="width: 100%" />
          </van-swipe-item>
          <van-swipe-item>
            <img src="/baking1/lunbo2.jpeg" style="width: 100%" />
          </van-swipe-item>
          <van-swipe-item>
            <img src="/baking1/lunbo3.jpeg" style="width: 100%" />
          </van-swipe-item>
          <van-swipe-item>
            <img src="/baking1/lunbo4.jpeg" style="width: 100%" />
          </van-swipe-item>
        </van-swipe>
        <!-- 滚动食谱 -->
        <div class="nav">
          <div class="left">
            <p>特色推荐</p>
          </div>
          <div class="right">
            <router-link to="/">查看全部</router-link>
          </div>
        </div>
        <div id="artic">
          <recipe-floor v-for="i in 5" :key="i"></recipe-floor>
        </div>
        <div class="nav">
          <div class="left">
            <p>下午茶</p>
          </div>
          <div class="right">
            <router-link to="/">查看全部</router-link>
          </div>
        </div>
        <div id="artic">
          <recipe-floor v-for="i in 5" :key="i"></recipe-floor>
        </div>
      </van-tab>
      <van-tab title="蛋糕">
        <div class="contain">
          <recipe-item v-for="i in 4" :key="i"></recipe-item>
        </div>
      </van-tab>
      <van-tab title="甜品点心">
        <recipe-item></recipe-item>
      </van-tab>
      <van-tab title="面包土司">
        <recipe-item></recipe-item>
      </van-tab>
      <van-tab title="中式点心">
        <recipe-item></recipe-item>
      </van-tab>
      <van-tab title="面食">
        <recipe-item></recipe-item>
      </van-tab>
      <van-tab title="其它">
        <recipe-item></recipe-item>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import RecipeItem from "../components/RecipeItem.vue";
import RecipeFloor from "@/components/RecipeFloor.vue";
export default {
  components: { RecipeItem, RecipeFloor },
  data() {
    return {
      active: 0,
      data: "",
    };
  },
  mounted() {
    // axios
    //   .get(
    //     "https://api.hongbeibang.com/recommend/getRandContent?_t=1666664162427&type=3&pageSize=10&timestamp=1666664162421"
    //   )
    //   .then((res) => {
    //     console.log(res);
    //     this.data = res.data;
    //   });
  },
};
</script>

<style scoped>
:deep(.van-icon) {
  color: #333;
}
:deep(.van-tabs__line) {
  bottom: 20px;
}
</style>

<style lang="scss" scoped>
.nav {
  background-color: #fff;
  padding: 0 10px;
  display: flex;
  justify-content: space-between;
}
.nav .left {
  text-align: center;
  line-height: 48px;
}
.nav .left p {
  font-size: 17px;
  color: #313131;
  margin: 0;
}
.nav .right {
  text-align: center;
  line-height: 48px;
}
.nav .right a {
  font-size: 14px;
  color: #999999;
}
#artic {
  display: flex;
  overflow-x: scroll;
}
.contain {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 0 15px;
}
</style>
